%     AERO LOAD - программа для нагружения агрегатов самолета распределенной нагрузкой
%     Copyright (C) 2018-2024  Михаил Козлов
%     Сайт проекта: <http://www.fastenerdoctor.ru/>
%     Адрес электронной почты для связи с разработчиком:
%     <doctor.fastener@gmail.com>
% 
%     Эта программа является свободным программным обеспечением: Вы можете
%     распространять ее и/или изменять, соблюдая условия Универсальной общественной
%     лицензии GNU, опубликованной Фондом свободного программного обеспечения,
%     либо редакции 3, либо (на Ваше усмотрение) любой редакции, выпущенной позже.
% 
%     Эта программа распространяется в надежде на то, что она окажется полезной,
%     но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, включая даже подразумеваемую гарантию ТОВАРНОЙ ПРИГОДНОСТИ,
%     либо ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Ознакомьтесь с Универсальной общественной
%     лицензией GNU для получения более подробной информации.
% 
%     Вы должны были получить копию Универсальной общественной лицензии GNU
%     вместе с этой программой. Если Вы ее не получили, то перейдите по адресу:
%     <http://www.gnu.org/licenses/>.
% 
%     This program is free software: you can redistribute it and/or modify
%     it under the terms of the GNU General Public License as published by
%     the Free Software Foundation, either version 3 of the License, or
%     (at your option) any later version.
% 
%     This program is distributed in the hope that it will be useful,
%     but WITHOUT ANY WARRANTY; without even the implied warranty of
%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%     GNU General Public License for more details.
% 
%     You should have received a copy of the GNU General Public License
%     along with this program.  If not, see <https://www.gnu.org/licenses/>.

function GW_Plot_Erase_Geom(src,~)

global Graphic_Window_Handle;
global Graphics_Properties;
global Graphics;

Axes_Handle = findall(Graphic_Window_Handle, 'Tag', 'Main_Axes');

switch src.Tag
    
    case 'Plot_Geom_Button'
        
        % Erase
        tmp.Value = 1;
        tmp.Tag = 'Erase_Geom_Button';
        GW_Plot_Erase_Geom(tmp,[]);
        
        % Проекции угловых точек поверхности хорд
        tmp.Value = 1;
        tmp.Tag = 'Draw_Proj_Corner_Points_Button';
        GW_Plot_Erase_Geom(tmp,[]);
        set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 1);

        % Проекция поверхности хорд
        tmp.Value = 1;
        tmp.Tag = 'Draw_Proj_Chord_Surface_Button';
        GW_Plot_Erase_Geom(tmp,[]);
        set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 1);
        
    case 'Erase_Geom_Button'
        
        % Угловые точки поверхности хорд
        tmp.Value = 0;
        tmp.Tag = 'Draw_Corner_Points_Button';
        GW_Plot_Erase_Geom(tmp,[]);
        set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0);

        % Проекции угловых точек поверхности хорд
        tmp.Value = 0;
        tmp.Tag = 'Draw_Proj_Corner_Points_Button';
        GW_Plot_Erase_Geom(tmp,[]);
        set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0);

        % Поверхность хорд
        tmp.Value = 0;
        tmp.Tag = 'Draw_Chord_Surface_Button';
        GW_Plot_Erase_Geom(tmp,[]);
        set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0);

        % Проекция поверхности хорд
        tmp.Value = 0;
        tmp.Tag = 'Draw_Proj_Chord_Surface_Button';
        GW_Plot_Erase_Geom(tmp,[]);
        set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0);
    
    case 'Draw_Corner_Points_Button'
        
        if (src.Value == 1)
            
            Sphere_Mesh_Density = Graphics_Properties.Sphere_Mesh_Density;
            Point_Radius = Graphics.Corner_Points_Radius;
            Points_Color = Graphics_Properties.Corner_Points_Color;
            
            [Sphere_X, Sphere_Y, Sphere_Z] = sphere(Graphics_Properties.Sphere_Mesh_Density);

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A1(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A1(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A1(3);

            Sphere_Handle_A1 = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A1, 'FaceColor', Points_Color);
            set(Sphere_Handle_A1, 'EdgeColor', 'none');
            set(Sphere_Handle_A1, 'Tag', 'Corner_Points');

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A2(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A2(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A2(3);

            Sphere_Handle_A2 = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A2, 'FaceColor', Points_Color);
            set(Sphere_Handle_A2, 'EdgeColor', 'none');
            set(Sphere_Handle_A2, 'Tag', 'Corner_Points');

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A3(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A3(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A3(3);

            Sphere_Handle_A3 = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A3, 'FaceColor', Points_Color);
            set(Sphere_Handle_A3, 'EdgeColor', 'none');
            set(Sphere_Handle_A3, 'Tag', 'Corner_Points');

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A4(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A4(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A4(3);

            Sphere_Handle_A4 = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A4, 'FaceColor', Points_Color);
            set(Sphere_Handle_A4, 'EdgeColor', 'none');
            set(Sphere_Handle_A4, 'Tag', 'Corner_Points');
            
            % Построить данные и нажать кнопку
            tmp.Value = 1;
            tmp.Tag = 'Label_Corner_Points_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 1, 'Enable', 'on');
            
        else
            
            % Удалить данные и деактивировать кнопку
            tmp.Value = 0;
            tmp.Tag = 'Label_Corner_Points_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0, 'Enable', 'off');
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'Corner_Points'));
            
        end
        
    case 'Label_Corner_Points_Button'
        
        if (src.Value == 1)
            
            if (isequal(get(Graphic_Window_Handle, 'Color'), [0 0 0]))
                Color = 'white';
            else
                Color = 'black';
            end

            A1_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A1(1), Graphics.Load.Chord_Surface.A1(2), Graphics.Load.Chord_Surface.A1(3), '     A1');
            set(A1_Label_Handle, 'Color', Color, 'Tag', 'A1_Label');

            A2_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A2(1), Graphics.Load.Chord_Surface.A2(2), Graphics.Load.Chord_Surface.A2(3), '     A2');
            set(A2_Label_Handle, 'Color', Color, 'Tag', 'A2_Label');

            A3_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A3(1), Graphics.Load.Chord_Surface.A3(2), Graphics.Load.Chord_Surface.A3(3), '     A3');
            set(A3_Label_Handle, 'Color', Color, 'Tag', 'A3_Label');

            A4_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A4(1), Graphics.Load.Chord_Surface.A4(2), Graphics.Load.Chord_Surface.A4(3), '     A4');
            set(A4_Label_Handle, 'Color', Color, 'Tag', 'A4_Label');
            
            % Активировать кнопку
            set(findall(Graphic_Window_Handle, 'Tag', 'Coord_Corner_Points_Button'), 'Enable', 'on');
            
        else
            
            % Удалить данные и деактивировать кнопку
            tmp.Value = 0;
            tmp.Tag = 'Coord_Corner_Points_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0, 'Enable', 'off');
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'A1_Label'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'A2_Label'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'A3_Label'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'A4_Label'));
            
        end
        
    case 'Coord_Corner_Points_Button'
        
        if (src.Value == 1)
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A1_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A1(1), Graphics.Load.Chord_Surface.A1(2), Graphics.Load.Chord_Surface.A1(3))];
            end

            handle = findall(Graphic_Window_Handle, 'Tag', 'A2_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A2(1), Graphics.Load.Chord_Surface.A2(2), Graphics.Load.Chord_Surface.A2(3))];
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A3_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A3(1), Graphics.Load.Chord_Surface.A3(2), Graphics.Load.Chord_Surface.A3(3))];
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A4_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A4(1), Graphics.Load.Chord_Surface.A4(2), Graphics.Load.Chord_Surface.A4(3))];
            end
            
        else
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A1_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:7);
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A2_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:7);
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A3_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:7);
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A4_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:7);
            end
            
        end
        
    case 'Draw_Proj_Corner_Points_Button'
        
        if (src.Value == 1)
            
            Sphere_Mesh_Density = Graphics_Properties.Sphere_Mesh_Density;
            Point_Radius = Graphics.Projected_Corner_Points_Radius;
            Points_Color = Graphics_Properties.Projected_Corner_Points_Color;
            
            [Sphere_X, Sphere_Y, Sphere_Z] = sphere(Graphics_Properties.Sphere_Mesh_Density);

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A1_projected(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A1_projected(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A1_projected(3);

            Sphere_Handle_A1_projected = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A1_projected, 'FaceColor', Points_Color);
            set(Sphere_Handle_A1_projected, 'EdgeColor', 'none');
            set(Sphere_Handle_A1_projected, 'Tag', 'Projected_Corner_Points');

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A2_projected(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A2_projected(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A2_projected(3);

            Sphere_Handle_A2_projected = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A2_projected, 'FaceColor', Points_Color);
            set(Sphere_Handle_A2_projected, 'EdgeColor', 'none');
            set(Sphere_Handle_A2_projected, 'Tag', 'Projected_Corner_Points');

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A3_projected(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A3_projected(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A3_projected(3);

            Sphere_Handle_A3_projected = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A3_projected, 'FaceColor', Points_Color);
            set(Sphere_Handle_A3_projected, 'EdgeColor', 'none');
            set(Sphere_Handle_A3_projected, 'Tag', 'Projected_Corner_Points');

            Tmp_X = Sphere_X*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A4_projected(1);
            Tmp_Y = Sphere_Y*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A4_projected(2);
            Tmp_Z = Sphere_Z*Point_Radius + ones(Sphere_Mesh_Density+1)*Graphics.Load.Chord_Surface.A4_projected(3);

            Sphere_Handle_A4_projected = surface(Axes_Handle, Tmp_X, Tmp_Y, Tmp_Z);

            set(Sphere_Handle_A4_projected, 'FaceColor', Points_Color);
            set(Sphere_Handle_A4_projected, 'EdgeColor', 'none');
            set(Sphere_Handle_A4_projected, 'Tag', 'Projected_Corner_Points');
            
            % Построить данные и нажать кнопку
            tmp.Value = 1;
            tmp.Tag = 'Label_Proj_Corner_Points_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 1, 'Enable', 'on');
            
        else
            
            % Удалить данные и деактивировать кнопку
            tmp.Value = 0;
            tmp.Tag = 'Label_Proj_Corner_Points_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0, 'Enable', 'off');
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'Projected_Corner_Points'));
            
        end
        
    case 'Label_Proj_Corner_Points_Button'
        
        if (src.Value == 1)
            
            if (isequal(get(Graphic_Window_Handle, 'Color'), [0 0 0]))
                Color = 'white';
            else
                Color = 'black';
            end
            
            switch Graphics_Properties.Language
                case 'RU'
                    string = ' (проекция)';
                case 'EN'
                    string = ' projected';
            end
            
            A1_Projected_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A1_projected(1), Graphics.Load.Chord_Surface.A1_projected(2), Graphics.Load.Chord_Surface.A1_projected(3), ['     A1' string]);
            set(A1_Projected_Label_Handle, 'Color', Color, 'Tag', 'A1_Projected_Label');

            A2_Projected_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A2_projected(1), Graphics.Load.Chord_Surface.A2_projected(2), Graphics.Load.Chord_Surface.A2_projected(3), ['     A2' string]);
            set(A2_Projected_Label_Handle, 'Color', Color, 'Tag', 'A2_Projected_Label');

            A3_Projected_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A3_projected(1), Graphics.Load.Chord_Surface.A3_projected(2), Graphics.Load.Chord_Surface.A3_projected(3), ['     A3' string]);
            set(A3_Projected_Label_Handle, 'Color', Color, 'Tag', 'A3_Projected_Label');

            A4_Projected_Label_Handle = text(Axes_Handle, Graphics.Load.Chord_Surface.A4_projected(1), Graphics.Load.Chord_Surface.A4_projected(2), Graphics.Load.Chord_Surface.A4_projected(3), ['     A4' string]);
            set(A4_Projected_Label_Handle, 'Color', Color, 'Tag', 'A4_Projected_Label');
            
            % Активировать кнопку
            set(findall(Graphic_Window_Handle, 'Tag', 'Coord_Proj_Corner_Points_Button'), 'Enable', 'on');
            
        else
            
            % Удалить данные и деактивировать кнопку
            tmp.Value = 0;
            tmp.Tag = 'Coord_Proj_Corner_Points_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0, 'Enable', 'off');
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'A1_Projected_Label'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'A2_Projected_Label'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'A3_Projected_Label'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'A4_Projected_Label'));
            
        end
        
    case 'Coord_Proj_Corner_Points_Button'
        
        if (src.Value == 1)
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A1_Projected_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A1_projected(1), Graphics.Load.Chord_Surface.A1_projected(2), Graphics.Load.Chord_Surface.A1_projected(3))];
            end

            handle = findall(Graphic_Window_Handle, 'Tag', 'A2_Projected_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A2_projected(1), Graphics.Load.Chord_Surface.A2_projected(2), Graphics.Load.Chord_Surface.A2_projected(3))];
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A3_Projected_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A3_projected(1), Graphics.Load.Chord_Surface.A3_projected(2), Graphics.Load.Chord_Surface.A3_projected(3))];
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A4_Projected_Label');
            if (~isempty(handle))
                handle.String = [handle.String sprintf('   [%g, %g, %g]', Graphics.Load.Chord_Surface.A4_projected(1), Graphics.Load.Chord_Surface.A4_projected(2), Graphics.Load.Chord_Surface.A4_projected(3))];
            end
            
        else
            
            switch Graphics_Properties.Language
                case 'RU'
                    str_len = 18;
                case 'EN'
                    str_len = 17;
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A1_Projected_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:str_len);
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A2_Projected_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:str_len);
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A3_Projected_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:str_len);
            end
            
            handle = findall(Graphic_Window_Handle, 'Tag', 'A4_Projected_Label');
            if (~isempty(handle))
                handle.String = handle.String(1:str_len);
            end
            
        end
        
    case 'Draw_Chord_Surface_Button'
        
        Slider_Handle = findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Translucency_Slider');
        
        if (src.Value == 1)
            
            Chord_Surf_Vertices = [Graphics.Load.Chord_Surface.A1'; ...
                                   Graphics.Load.Chord_Surface.A2'; ...
                                   Graphics.Load.Chord_Surface.A3'; ...
                                   Graphics.Load.Chord_Surface.A4'];
            Chord_Surf_Faces = [1,2,4,3];
            
            patch(Axes_Handle, 'Vertices', Chord_Surf_Vertices, ...
                               'Faces', Chord_Surf_Faces, ...
                               'FaceColor', Graphics_Properties.Chord_Surf_Color, ...
                               'EdgeColor', 'none', ...
                               'FaceAlpha', Slider_Handle.Value, ...
                               'Tag', 'Chord_Surface');
            
            Chord_Surf_Boundary = [Graphics.Load.Chord_Surface.A1, ...
                                   Graphics.Load.Chord_Surface.A2, ...
                                   Graphics.Load.Chord_Surface.A4, ...
                                   Graphics.Load.Chord_Surface.A3, ...
                                   Graphics.Load.Chord_Surface.A1];
            
            Boundary_Handle = plot3(Axes_Handle, Chord_Surf_Boundary(1,:), Chord_Surf_Boundary(2,:), Chord_Surf_Boundary(3,:));

            set(Boundary_Handle, 'Color', Graphics_Properties.Chord_Surf_Boundary_Color);
            set(Boundary_Handle, 'LineWidth', Graphics_Properties.Chord_Surf_Boundary_Width);
            set(Boundary_Handle, 'Tag', 'Chord_Surface_Boundary');
            
            % Активировать кнопку
            set(findall(Graphic_Window_Handle, 'Tag', 'Draw_Chord_Surface_Param_Button'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Translucency_Slider'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Translucency_Text'), 'Enable', 'on');
            
        else
            
            % Удалить данные и деактивировать кнопку
            tmp.Value = 0;
            tmp.Tag = 'Draw_Chord_Surface_Param_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0, 'Enable', 'off');
            
            % Деактивировать кнопку
            set(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Translucency_Slider'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Translucency_Text'), 'Enable', 'off');
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Boundary'));
            
        end
        
    case 'Draw_Chord_Surface_Param_Button'
        
        if (src.Value == 1)
            
            % Построение параметрических линий размаха на поверхности хорд
            if (Graphics_Properties.Chord_Surf_N_Param_Lines_Span > 0)
                
                tmp = NaN(Graphics_Properties.Chord_Surf_N_Param_Lines_Span*3,3);

                for i=1:Graphics_Properties.Chord_Surf_N_Param_Lines_Span

                    Start_Point = Graphics.Load.Chord_Surface.A1 + (Graphics.Load.Chord_Surface.A2 - Graphics.Load.Chord_Surface.A1)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Span + 1)*i;
                    End_Point = Graphics.Load.Chord_Surface.A3 + (Graphics.Load.Chord_Surface.A4 - Graphics.Load.Chord_Surface.A3)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Span + 1)*i;

                    tmp((i-1)*3+1,1) = Start_Point(1);
                    tmp((i-1)*3+1,2) = Start_Point(2);
                    tmp((i-1)*3+1,3) = Start_Point(3);

                    tmp((i-1)*3+2,1) = End_Point(1);
                    tmp((i-1)*3+2,2) = End_Point(2);
                    tmp((i-1)*3+2,3) = End_Point(3);

                end

                handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
                set(handle, 'Color', Graphics_Properties.Chord_Surf_Parametric_Lines_Color);
                set(handle, 'Tag', 'Chord_Surface_Param_Lines_Span');
            
            end
            
            % Построение параметрических линий хорд на поверхности хорд
            if (Graphics_Properties.Chord_Surf_N_Param_Lines_Chord > 0)
                
                tmp = NaN(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord*3,3);

                for i=1:Graphics_Properties.Chord_Surf_N_Param_Lines_Chord

                    Start_Point = Graphics.Load.Chord_Surface.A1 + (Graphics.Load.Chord_Surface.A3 - Graphics.Load.Chord_Surface.A1)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord + 1)*i;
                    End_Point = Graphics.Load.Chord_Surface.A2 + (Graphics.Load.Chord_Surface.A4 - Graphics.Load.Chord_Surface.A2)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord + 1)*i;

                    tmp((i-1)*3+1,1) = Start_Point(1);
                    tmp((i-1)*3+1,2) = Start_Point(2);
                    tmp((i-1)*3+1,3) = Start_Point(3);

                    tmp((i-1)*3+2,1) = End_Point(1);
                    tmp((i-1)*3+2,2) = End_Point(2);
                    tmp((i-1)*3+2,3) = End_Point(3);

                end

                handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
                set(handle, 'Color', Graphics_Properties.Chord_Surf_Parametric_Lines_Color);
                set(handle, 'Tag', 'Chord_Surface_Param_Lines_Chord');
            
            end
            
            % Активировать кнопки
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Plus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Minus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Plus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Minus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Number'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Number'), 'Enable', 'on');
            
        else
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Span'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Chord'));
            
            % Деактивировать кнопки
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Plus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Minus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Plus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Minus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Number'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Number'), 'Enable', 'off');
            
        end
        
    case 'Chord_Surface_Translucency_Slider'
        
        set(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface'), 'FaceAlpha', src.Value);
        set(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Translucency_Text'), 'String', sprintf('%.2f', src.Value));
        
    case 'CS_Param_Span_Plus'
        
        Graphics_Properties.Chord_Surf_N_Param_Lines_Span = Graphics_Properties.Chord_Surf_N_Param_Lines_Span + 1;
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Span > 99)
            Graphics_Properties.Chord_Surf_N_Param_Lines_Span = 99;
        end
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Span > 0)

            tmp = NaN(Graphics_Properties.Chord_Surf_N_Param_Lines_Span*3,3);

            for i=1:Graphics_Properties.Chord_Surf_N_Param_Lines_Span

                Start_Point = Graphics.Load.Chord_Surface.A1 + (Graphics.Load.Chord_Surface.A2 - Graphics.Load.Chord_Surface.A1)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Span + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A3 + (Graphics.Load.Chord_Surface.A4 - Graphics.Load.Chord_Surface.A3)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Span + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Span'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Chord_Surface_Param_Lines_Span');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Number'), 'String', sprintf('%i', Graphics_Properties.Chord_Surf_N_Param_Lines_Span));
        
    case 'CS_Param_Span_Minus'
        
        Graphics_Properties.Chord_Surf_N_Param_Lines_Span = Graphics_Properties.Chord_Surf_N_Param_Lines_Span - 1;
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Span <= 0)
            Graphics_Properties.Chord_Surf_N_Param_Lines_Span = 0;
            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Span'));
        end
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Span > 0)

            tmp = NaN(Graphics_Properties.Chord_Surf_N_Param_Lines_Span*3,3);

            for i=1:Graphics_Properties.Chord_Surf_N_Param_Lines_Span

                Start_Point = Graphics.Load.Chord_Surface.A1 + (Graphics.Load.Chord_Surface.A2 - Graphics.Load.Chord_Surface.A1)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Span + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A3 + (Graphics.Load.Chord_Surface.A4 - Graphics.Load.Chord_Surface.A3)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Span + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Span'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Chord_Surface_Param_Lines_Span');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Span_Number'), 'String', sprintf('%i', Graphics_Properties.Chord_Surf_N_Param_Lines_Span));
        
    case 'CS_Param_Chord_Plus'
        
        Graphics_Properties.Chord_Surf_N_Param_Lines_Chord = Graphics_Properties.Chord_Surf_N_Param_Lines_Chord + 1;
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Chord > 99)
            Graphics_Properties.Chord_Surf_N_Param_Lines_Chord = 99;
        end
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Chord > 0)

            tmp = NaN(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord*3,3);

            for i=1:Graphics_Properties.Chord_Surf_N_Param_Lines_Chord

                Start_Point = Graphics.Load.Chord_Surface.A1 + (Graphics.Load.Chord_Surface.A3 - Graphics.Load.Chord_Surface.A1)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A2 + (Graphics.Load.Chord_Surface.A4 - Graphics.Load.Chord_Surface.A2)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Chord'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Chord_Surface_Param_Lines_Chord');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Number'), 'String', sprintf('%i', Graphics_Properties.Chord_Surf_N_Param_Lines_Chord));
        
    case 'CS_Param_Chord_Minus'
        
        Graphics_Properties.Chord_Surf_N_Param_Lines_Chord = Graphics_Properties.Chord_Surf_N_Param_Lines_Chord - 1;
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Chord <= 0)
            Graphics_Properties.Chord_Surf_N_Param_Lines_Chord = 0;
            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Chord'));
        end
        
        if (Graphics_Properties.Chord_Surf_N_Param_Lines_Chord > 0)

            tmp = NaN(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord*3,3);

            for i=1:Graphics_Properties.Chord_Surf_N_Param_Lines_Chord

                Start_Point = Graphics.Load.Chord_Surface.A1 + (Graphics.Load.Chord_Surface.A3 - Graphics.Load.Chord_Surface.A1)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A2 + (Graphics.Load.Chord_Surface.A4 - Graphics.Load.Chord_Surface.A2)/(Graphics_Properties.Chord_Surf_N_Param_Lines_Chord + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Chord_Surface_Param_Lines_Chord'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Chord_Surface_Param_Lines_Chord');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'CS_Param_Chord_Number'), 'String', sprintf('%i', Graphics_Properties.Chord_Surf_N_Param_Lines_Chord));
        
    case 'Draw_Proj_Chord_Surface_Button'
        
        Slider_Handle = findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Translucency_Slider');
        
        if (src.Value == 1)
            
            Projected_Chord_Surf_Vertices = [Graphics.Load.Chord_Surface.A1_projected'; ...
                                             Graphics.Load.Chord_Surface.A2_projected'; ...
                                             Graphics.Load.Chord_Surface.A3_projected'; ...
                                             Graphics.Load.Chord_Surface.A4_projected'];
            Projected_Chord_Surf_Faces = [1,2,4,3];
            
            patch(Axes_Handle, 'Vertices', Projected_Chord_Surf_Vertices, ...
                               'Faces', Projected_Chord_Surf_Faces, ...
                               'FaceColor', Graphics_Properties.Projected_Chord_Surf_Color, ...
                               'EdgeColor', 'none', ...
                               'FaceAlpha', Slider_Handle.Value, ...
                               'Tag', 'Proj_Chord_Surface');
                           
            Projected_Chord_Surf_Boundary = [Graphics.Load.Chord_Surface.A1_projected, ...
                                             Graphics.Load.Chord_Surface.A2_projected, ...
                                             Graphics.Load.Chord_Surface.A4_projected, ...
                                             Graphics.Load.Chord_Surface.A3_projected, ...
                                             Graphics.Load.Chord_Surface.A1_projected];
                           
            Boundary_Handle = plot3(Axes_Handle, Projected_Chord_Surf_Boundary(1,:), Projected_Chord_Surf_Boundary(2,:), Projected_Chord_Surf_Boundary(3,:));

            set(Boundary_Handle, 'Color', Graphics_Properties.Projected_Chord_Surf_Boundary_Color);
            set(Boundary_Handle, 'LineWidth', Graphics_Properties.Projected_Chord_Surf_Boundary_Width);
            set(Boundary_Handle, 'Tag', 'Proj_Chord_Surface_Boundary');
            
            % Активировать кнопку
            set(findall(Graphic_Window_Handle, 'Tag', 'Draw_Proj_Chord_Surface_Param_Button'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Translucency_Slider'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Translucency_Text'), 'Enable', 'on');
            
        else
            
            % Удалить данные и деактивировать кнопку
            tmp.Value = 0;
            tmp.Tag = 'Draw_Proj_Chord_Surface_Param_Button';
            GW_Plot_Erase_Geom(tmp,[]);
            set(findall(Graphic_Window_Handle, 'Tag', tmp.Tag), 'Value', 0, 'Enable', 'off');
            
            % Деактивировать кнопку
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Translucency_Slider'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Translucency_Text'), 'Enable', 'off');
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Boundary'));
            
        end
        
    case 'Draw_Proj_Chord_Surface_Param_Button'
        
        if (src.Value == 1)
            
            % Построение параметрических линий размаха на поверхности хорд
            if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span > 0)
                
                tmp = NaN(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span*3,3);

                for i=1:Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span

                    Start_Point = Graphics.Load.Chord_Surface.A1_projected + (Graphics.Load.Chord_Surface.A2_projected - ...
                        Graphics.Load.Chord_Surface.A1_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span + 1)*i;
                    End_Point = Graphics.Load.Chord_Surface.A3_projected + (Graphics.Load.Chord_Surface.A4_projected - ...
                        Graphics.Load.Chord_Surface.A3_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span + 1)*i;

                    tmp((i-1)*3+1,1) = Start_Point(1);
                    tmp((i-1)*3+1,2) = Start_Point(2);
                    tmp((i-1)*3+1,3) = Start_Point(3);

                    tmp((i-1)*3+2,1) = End_Point(1);
                    tmp((i-1)*3+2,2) = End_Point(2);
                    tmp((i-1)*3+2,3) = End_Point(3);

                end

                handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
                set(handle, 'Color', Graphics_Properties.Projected_Chord_Surf_Parametric_Lines_Color);
                set(handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Span');
            
            end
            
            % Построение параметрических линий хорд на поверхности хорд
            if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord > 0)
                
                tmp = NaN(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord*3,3);

                for i=1:Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord

                    Start_Point = Graphics.Load.Chord_Surface.A1_projected + (Graphics.Load.Chord_Surface.A3_projected - ...
                        Graphics.Load.Chord_Surface.A1_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord + 1)*i;
                    End_Point = Graphics.Load.Chord_Surface.A2_projected + (Graphics.Load.Chord_Surface.A4_projected - ...
                        Graphics.Load.Chord_Surface.A2_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord + 1)*i;

                    tmp((i-1)*3+1,1) = Start_Point(1);
                    tmp((i-1)*3+1,2) = Start_Point(2);
                    tmp((i-1)*3+1,3) = Start_Point(3);

                    tmp((i-1)*3+2,1) = End_Point(1);
                    tmp((i-1)*3+2,2) = End_Point(2);
                    tmp((i-1)*3+2,3) = End_Point(3);

                end

                handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
                set(handle, 'Color', Graphics_Properties.Projected_Chord_Surf_Parametric_Lines_Color);
                set(handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Chord');
            
            end
            
            % Активировать кнопки
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Plus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Minus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Plus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Minus'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Number'), 'Enable', 'on');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Number'), 'Enable', 'on');
            
        else
            
            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Span'));
            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Chord'));
            
            % Деактивировать кнопки
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Plus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Minus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Plus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Minus'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Number'), 'Enable', 'off');
            set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Number'), 'Enable', 'off');
            
        end
        
    case 'Proj_Chord_Surface_Translucency_Slider'
        
        set(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface'), 'FaceAlpha', src.Value);
        set(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Translucency_Text'), 'String', sprintf('%.2f', src.Value));
        
    case 'Proj_CS_Param_Span_Plus'
        
        Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span = Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span + 1;
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span > 99)
            Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span = 99;
        end
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span > 0)

            tmp = NaN(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span*3,3);

            for i=1:Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span

                Start_Point = Graphics.Load.Chord_Surface.A1_projected + (Graphics.Load.Chord_Surface.A2_projected - ...
                    Graphics.Load.Chord_Surface.A1_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A3_projected + (Graphics.Load.Chord_Surface.A4_projected - ...
                    Graphics.Load.Chord_Surface.A3_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Span'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Projected_Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Span');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Number'), 'String', sprintf('%i', Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span));
        
    case 'Proj_CS_Param_Span_Minus'
        
        Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span = Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span - 1;
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span <= 0)
            Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span = 0;
            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Span'));
        end
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span > 0)

            tmp = NaN(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span*3,3);

            for i=1:Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span

                Start_Point = Graphics.Load.Chord_Surface.A1_projected + (Graphics.Load.Chord_Surface.A2_projected - ...
                    Graphics.Load.Chord_Surface.A1_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A3_projected + (Graphics.Load.Chord_Surface.A4_projected - ...
                    Graphics.Load.Chord_Surface.A3_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Span'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Projected_Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Span');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Span_Number'), 'String', sprintf('%i', Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Span));
        
    case 'Proj_CS_Param_Chord_Plus'
        
        Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord = Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord + 1;
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord > 99)
            Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord = 99;
        end
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord > 0)

            tmp = NaN(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord*3,3);

            for i=1:Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord

                Start_Point = Graphics.Load.Chord_Surface.A1_projected + (Graphics.Load.Chord_Surface.A3_projected - ...
                    Graphics.Load.Chord_Surface.A1_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A2_projected + (Graphics.Load.Chord_Surface.A4_projected - ...
                    Graphics.Load.Chord_Surface.A2_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Chord'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Projected_Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Chord');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Number'), 'String', sprintf('%i', Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord));
        
    case 'Proj_CS_Param_Chord_Minus'
        
        Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord = Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord - 1;
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord <= 0)
            Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord = 0;
            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Chord'));
        end
        
        if (Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord > 0)

            tmp = NaN(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord*3,3);

            for i=1:Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord

                Start_Point = Graphics.Load.Chord_Surface.A1_projected + (Graphics.Load.Chord_Surface.A3_projected - ...
                    Graphics.Load.Chord_Surface.A1_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord + 1)*i;
                End_Point = Graphics.Load.Chord_Surface.A2_projected + (Graphics.Load.Chord_Surface.A4_projected - ...
                    Graphics.Load.Chord_Surface.A2_projected)/(Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord + 1)*i;

                tmp((i-1)*3+1,1) = Start_Point(1);
                tmp((i-1)*3+1,2) = Start_Point(2);
                tmp((i-1)*3+1,3) = Start_Point(3);

                tmp((i-1)*3+2,1) = End_Point(1);
                tmp((i-1)*3+2,2) = End_Point(2);
                tmp((i-1)*3+2,3) = End_Point(3);

            end

            delete(findall(Graphic_Window_Handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Chord'));
            handle = plot3(Axes_Handle, tmp(:,1), tmp(:,2), tmp(:,3));
            set(handle, 'Color', Graphics_Properties.Projected_Chord_Surf_Parametric_Lines_Color);
            set(handle, 'Tag', 'Proj_Chord_Surface_Param_Lines_Chord');

        end
        
        set(findall(Graphic_Window_Handle, 'Tag', 'Proj_CS_Param_Chord_Number'), 'String', sprintf('%i', Graphics_Properties.Projected_Chord_Surf_N_Param_Lines_Chord));
        
end
